package online.sixfish.doubao.enumration;


import java.util.Arrays;
import java.util.List;

public enum ArticleTypeEnum {
    DISCUSS(1,"讨论"),
    ANSWER(2,"答疑");

    private final int id;
    private final String desc;

    ArticleTypeEnum(int id, String desc) {
        this.id = id;
        this.desc = desc;
    }

    public int getId() {
        return id;
    }

    public String getDesc() {
        return desc;
    }

    public static ArticleTypeEnum getById(int id) {
        for (ArticleTypeEnum type : ArticleTypeEnum.values()) {
            if (id == type.id) {
                return type;
            }
        }
        return null;
    }

    public static List<ArticleTypeEnum> getAllArticleType() {
        return Arrays.asList(ArticleTypeEnum.values());
    }
}
